Ext.define('com.hh.form.ColumnList', {
	extend : 'com.hh.global.SimpleGridPanelWindow',
	action : 'form-FormWidget-',
	title : '删除字段',
	width : 600,
	height : 400,
	modal:true,
	gridAction : 'queryColumnList',
	constructor : function(config) {
		this.config = config || {};
		this.superclass.constructor.call(this, this.config);
		this.init();
	},
	pkey : 'COLUMN_NAME',
	getSearchPanelItems : function() {
		return [   ]
	},
	getTbarItems : function() {
		return [ this.getToolbarItem("delete") ];
	},
	getRightMenuItems : function() {
		var toolbarItems = [];
		toolbarItems.push(this.getToolbarItem("delete"));
		return toolbarItems;
	},
	getContainerRightMenuItems : function() {
		var toolbarItems = [];
		return toolbarItems;
	},
	getGridColumns : function() {
		return [ {
			text : '表名',
			dataIndex : 'TABLE_NAME',
			flex : 1
		}, {
			text : '列名',
			dataIndex : 'COLUMN_NAME',
			flex : 1
		}, {
			text : '类型',
			dataIndex : 'DATA_TYPE',
			flex : 1
		}, {
			text : '长度',
			dataIndex : 'DATA_LENGTH',
			flex : 1
		} ];
	},
	getStoreFields : function() {
		return [ 'TABLE_NAME', 'COLUMN_NAME', 'DATA_TYPE', 'DATA_LENGTH'];
	},
	doDelete : function() {
		var panel = this;
		var url = panel.action + 'deleteColumnByIdsTabName';
		var grid = this.grid;
		var records = grid.getSelectionModel().getSelection();
		this.doBaseDelete(grid, records, url);
	},
	doBaseDelete : function(grid, records, url) {
		if (Util.isNull(records)) {
			ExtFrame.info("请选中要删除的数据！");
		} else {
			var strids = Util.recordsToStrByKey(records, this.pkey);
			var vorgids = Util.recordsToStrByKey(records,
					"vorgid");
			var vcreates = Util.recordsToStrByKey(records,
					"vcreate");

			if (Util.isNull(strids)) {
				return;
			}
			var result = Ext.Msg
					.confirm(
							'请确认',
							'<span style="color:red"><b>提示:</b>您确认要删除信息吗？,请慎重...</span>',
							function(btn) {
								if (btn == 'yes') {
									Request
											.synRequestObject(
													url,
													{
														ids : strids,
														orgids : vorgids,
														vcreates : vcreates,
														tableName : records[0].get('TABLE_NAME')
													});
									grid.getStore().load();
								}
							});
		}
	}
});